﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace BaseballGame.Models
{
    public class game_entitiesDbContext : DbContext
    {
        public DbSet<positions> positions { get; set; }
        public DbSet<Player> players { get; set; }
        public DbSet<Team> teams { get; set; }
        public DbSet<league> leagues { get; set; }
        public DbSet<LeagueStandings> leagueStandings { get; set; }
		public DbSet<GameStats> gameStats { get; set; }
		public DbSet<PlayerHittingGameStats> playerHittingGameStats { get; set; }
		public DbSet<PlayerPitchingGameStat> playerPithichGameStat { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<System.Data.Entity.ModelConfiguration.Conventions.OneToManyCascadeDeleteConvention>();
            // will get rid of an error exeption thrown by the database, deletion of items will not cascade down into other tables]]]]]
            //error: Introducing FOREIGN KEY constraint 'FK_dbo.teams_dbo.players_FirstBaseId' on table 'teams' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
            //Could not create constraint. See previous errors.
        }
    }
}